/*
 *说明：资源账号信息表 增加/修改脚本
 *
 *@author liuxun 2012-03-18
*/

var opeForm;
var operationType;

$(function(){

	opeForm=$('#opeForm');

	opeForm.url = 'C_RSC_ACC!doInsertPullRSCACC.do';
	$('#okBtn').click(doOk);
	$('#cancelBtn').click(closeWin);
});

//新增时用到
function passwordTypeChange(){
	var temp = document.getElementById('password').value;
	if($("#showPass").attr("checked")){
		document.getElementById('pass').innerHTML='<input type="text" id="password" name="model.password" required="true" validType="" class="easyui-validatebox  editMainText" value="${model.password}" maxlength="50">';
	}else{
		document.getElementById('pass').innerHTML='<input type=password id="password" name="model.password" required="true" validType="" class="easyui-validatebox  editMainText" value="${model.password}" maxlength="50">';
	} 
	document.getElementById('password').value=temp;
}

//是否立即重置改变事件
function changeIsreset() {
	var is_modify_password = $('#is_modify_password').val();
	if (isEmpty(is_modify_password)) {
		$('#password').attr('required', '');
		$('#password').val('');
		$('#password').hide();
	}else if(is_modify_password == '1') {
		$('#password').attr('required', '');
		$('#password').val('');
		$('#passwordTR').hide();
	}else {
		$('#password').attr('required', 'true');
		$('#password').val('');
		$('#passwordTR').show();
	}
}

//保存按钮操作
function doOk() {

	var validateResult = opeForm.form('validate');

	if (!validateResult){
		showInfoWin('请正确填写信息!');
		return;
	}
	showSystemProccessing();
	var options = { 
		url: opeForm.url,
		type: 'post',
		success: function(data){
			removeSystemProccessing();
			getOpenerWin().deleteRowsOperation();
			
			showInfoWin('操作成功!', function() {window.close();});
		}
	};
	
	opeForm.ajaxSubmit(options);
}

